<template>
  <div class="app-container">
    <div class="app-form">
      <bloc :extra="extra" :order="order" @request="handleRequest" @closePage="closePage" />
    </div>
  </div>
</template>

<script>
import bloc from '@/components/Bloc/bloc.vue'
import { brandCreate } from '@projectName/views/diandi_place/api/place/brand'
export default {
  components: {
    bloc
  },
  data() {
    return {
      extra: {
        displayorder: {
          type: 'input',
          label: '排序'
        },
        status: {
          type: 'radio',
          label: '状态:是否开启',
          isOptions: true,
          options: [
            {
              text: '启用',
              value: 1
            },
            {
              text: '未启用',
              value: 0
            }
          ]
        }
      },
      order: []
    }
  },
  methods: {
    handleRequest(data) {
      brandCreate(data).then((response) => {
        if (response.code === 200) {
          this.$message.success(response.message)
          this.closePage()
        } else {
          this.$message.error(response.message)
        }
      })
      return Promise.resolve()
    },
    handleRequestSuccess() {},
    closePage() {
      this.$store.dispatch('app/closePage', {
        vm: this,
        fromName: this.$route.name,
        toName: 'diandi-place-place-brand-index',
        params: {}
      })
    }
  }
}
</script>
